+2005-08-22 Øyvind Kolås <pippin@gimp.org>
+
+ * babl/babl.c: implement ref counting to avoid unneccesary destruction
+ of static data when multiple instances of babl is used in an
+ adressspace.
+
+2005-08-23 Øyvind Kolås <pippin@gimp.org>
+
+ * tests/Makefile.am:
+ * tests/babl_class_name.c: new test.
+
2005-08-22 Øyvind Kolås <pippin@gimp.org>
* babl/babl-classes.h: (BabPixelFormat): only a single BablModel.
#include "babl-sanity.h"
#include "babl-introspect.h"
+static int ref_count=0;
+
void
babl_init (void)
{
- babl_type_init ();
- babl_sampling_init ();
- babl_component_init ();
- babl_model_init ();
- babl_pixel_format_init ();
- babl_conversion_init ();
- babl_base_init ();
-
- babl_sanity ();
+ if (ref_count++==0)
+ {
+ babl_type_init ();
+ babl_sampling_init ();
+ babl_component_init ();
+ babl_model_init ();
+ babl_pixel_format_init ();
+ babl_conversion_init ();
+ babl_base_init ();
+ babl_sanity ();
+ }
}
void
babl_destroy (void)
{
- /* babl_base is destroy by the containing types */
-
- babl_fish_destroy ();
- babl_conversion_destroy ();
- babl_pixel_format_destroy ();
- babl_model_destroy ();
- babl_component_destroy ();
- babl_sampling_destroy ();
- babl_type_destroy ();
+ /* babl_base is destroyed by the containing types */
- babl_memory_sanity ();
+ if (!--ref_count)
+ {
+ babl_fish_destroy ();
+ babl_conversion_destroy ();
+ babl_pixel_format_destroy ();
+ babl_model_destroy ();
+ babl_component_destroy ();
+ babl_sampling_destroy ();
+ babl_type_destroy ();
+ babl_memory_sanity ();
+ }
}